package cn.baker.app.consumer;

import cn.baker.app.common.RabbitConstants;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageProperties;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.Configuration;

@Slf4j
@Configuration
public class RabbitMqConsumer {

//    @RabbitListener(bindings = @QueueBinding(
//            exchange = @Exchange(value = RabbitConstants.TEST_EXCHANGE, type = ExchangeTypes.FANOUT),
//            value = @Queue(value = RabbitConstants.TEST_QUEUE, durable = "true")
//    ), concurrency = "2")
//    public void handMessage(Message message) {
//        MessageProperties messageProperties = message.getMessageProperties();
//        String body = new String(message.getBody());
//        log.info(">>>>> 接收到消息,body:[{}]", body);
//    }

}
